/****************************************************
	文件：Enemy.cs
	作者：林文豪
	日期：2021/03/28 15:33:38
	功能：Noting
*****************************************************/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MyGame.AI.GOAP;
using MyGame.Global;

namespace MyGame.Character {
    public class Enemy : ICharacter {
        public  string               Name;  // 名称
        public  int                  MaxHp; // 最大生命值
        public  float                Ken;   // 视野
        public  List<GoapGoalType>   Goals;
        public  List<GoapActionType> Actions;
        public  int                  _CurrentHp;
        
        private AgentBase           _GoapAgent;
        private EnemyGoapStaticData _ExcelData; // 表格中存储的静态数据
        
        public EnemyGoapStaticData ExcelData => _ExcelData;
        public AgentBase              GoapAgent => _GoapAgent;

        // Start is called before the first frame update
        void Start() {
            InitEnemyData();
            _GoapAgent = new AgentBase(this);
        }

        // Update is called once per frame
        void Update() {
            _GoapAgent.FrameFunc();
        }

        public void Init(EnemyGoapStaticData excelData) {
            _ExcelData = excelData;
            Name       = _ExcelData.EnemyName;
            MaxHp      = _ExcelData.MaxHp;
            Ken        = _ExcelData.Ken;
            Goals      = _ExcelData.AllGoals;
            Actions    = _ExcelData.AllActions;
        }

        private void InitEnemyData() {
            _CurrentHp = MaxHp;
        }
    }
}
